package indigo.loader.types 
{
	/**
	 * @author Patrick Pietens
	 *
	 */
	public class LoaderTypes 
	{
		/**
		 * String that indicates the Binary file type
		 */
		public static const BINARY:String = "binary";
		/**
		 * String that indicates the Image file type
		 */
		public static const IMAGE:String = "image";
		/**
		 * String that indicates the SWF file type
		 */
		public static const SWF:String = "swf";
		/**
		 * String that indicates the Video file type
		 */
		public static const VIDEO:String = "video";
		/**
		 * String that indicates the Sound file type
		 */
		public static const SOUND:String = "sound";
		/**
		 * String that indicates the Text file type
		 */
		public static const TEXT:String = "text";	
		/**
		 * String that indicates the Unknown file type
		 */
		public static const UNKNOWN:String = "unknown";

		
		/**
		 * Get the file type according the file extension
		 * @param	String that indicates the file
		 *  
		 */
		public static function getLoaderType( filename:String ):String
		{
			var mySplit:Array = filename.split( "." );
			var myExtension:String = ( mySplit[ mySplit.length - 1 ] as String ).toLowerCase( );
			var myType:String = LoaderTypes.UNKNOWN;
			
			switch ( myExtension )
			{
				case "mp3": 
					myType = LoaderTypes.SOUND; 
					break;	
				case "swf": 
					myType = LoaderTypes.SWF;
					break;
				case "jpg": 
				case "jpeg": 
				case "gif": 
				case "png": 
					myType = LoaderTypes.IMAGE; 
					break;
				case "flv": 
				case "fv4":	
					myType = LoaderTypes.VIDEO; 
					break;
				case "css": 
				case "dae": 
				case "xml": 
				case "txt": 
					myType = LoaderTypes.TEXT; 
					break;
				case "md2": 
					myType = LoaderTypes.BINARY; 
					break;
			}
			
			return myType;			
		}
	}
}
